﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenTK.Mathematics;

namespace Core.Maths
{
    public readonly struct Plane
    {
        public readonly Vector3 Position;
        public readonly Vector3 Normal;
        public Plane(Vector3 position, Vector3 normal)
        {
            Position = position;
            Normal = normal;
        }

        public readonly float DistanceToPlane(in Vector3 point)
        {
            return Vector3.Dot(point , Vector3.Normalize(Normal)) - Vector3.Distance(Position, Vector3.Zero);
        }
    }
}
